<template>
	<view class="mask" @click="closePage()">
		<view class="main">
			<text>选择客服</text>
			<view class="jobTime"> 工作时间 {{ businessHours }}
			</view>
			<view class="main-view" @click="onlineKefu()">
				<image src="../../static/icon3/2ersfgfdfdvfds.png" mode="aspectFill"></image>
				<text>在线客服</text>
			</view>
			<!-- <view class="main-view" @click="Kefuweixin()">
				<image src="../../static/icon3/2ersfgfdfdvfds.png" mode="aspectFill"></image>
				<text>客服微信</text>
			</view> -->
			<view class="main-view" @click="kefu_phone()">
				<image src="../../static/icon3/1132ewrwrwefdsdsfds.png" mode="aspectFill"></image>
				<text>电话客服</text>
			</view>
		</view>
	</view>
</template>
<script>
	import phoneLimite from '@/libs/function/phoneLimite.js' //判断是否有拨打电话权限
	export default {
		props: {
			businessHours: null
		},
		data() {
			return {
				telephone: '',
				kefu_wechat: '',
			}
		},
		methods: {
			kefu_phone() {
				this.closePage()
				phoneLimite(this.telephone)
			},
			onlineKefu() {
				this.closePage()
				uni.navigateTo({
					url: '/pages/onLinePage/kefu?userId=' + uni.getStorageSync('userInfo').userId
				})
			},
			Kefuweixin() {
				// #ifdef APP-PLUS
				uni.setClipboardData({
					data: this.kefu_wechat,
					success: function() {
						uni.showToast({
							title: '复制成功',
							icon: 'none'
						})
					}
				})
				// #endif
				// #ifdef H5
				let input = document.createElement('input');
				input.setAttribute('readonly', 'readonly');
				input.setAttribute('value', this.kefu_wechat);
				document.body.appendChild(input);
				input.select()
				if (document.execCommand('copy')) {
					uni.showToast({
						title: '复制成功',
						icon: 'none'
					})
					document.body.removeChild(input)
					//success info
				}
				// #endif
			},
			closePage() {
				this.$emit('closePage')
			},
		},
		mounted() {},
		beforeMount() {
			this.telephone = uni.getStorageSync('userType') == 1 ? uni.getStorageSync('employerTelephone') : uni
				.getStorageSync('property_list_by_type').telephone
			this.kefu_wechat = uni.getStorageSync('property_list_by_type').kefu_wechat
		},
	}
</script>
<style lang="less" scoped>
	.mask {
		width: 100vw;
		height: 100vh;
		background-color: rgba(0, 0, 0, .7);
		position: fixed;
		top: 0;
		left: 0;
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 999;
	}

	.main {
		width: 550rpx;
		height: 530rpx;
		background: #FFFFFF;
		border-radius: 12rpx;
		display: flex;
		flex-direction: column;
		align-items: center;

		&>text:nth-child(1) {
			font-size: 36rpx;
			font-weight: bold;
			color: #000000;
			line-height: 49rpx;
			margin-top: 60rpx;
		}

		// 工作时间
		.jobTime {
			font-size: 25rpx;
			color: black;
			margin-top: 40rpx;
		}
	}

	.main-view {
		width: 438rpx;
		height: 98rpx;
		background: #FCC928;
		border-radius: 12rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 40rpx;

		&>image {
			width: 60rpx;
			height: 60rpx;
		}

		&>text {
			font-size: 32rpx;
			font-weight: bold;
			color: #402110;
			line-height: 49rpx;
			margin-left: 20rpx;
		}
	}
</style>